package com.slaffka.model;

import org.jboss.solder.core.Veto;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 * User: slaffka
 * Date: 04.11.12
 * Time: 17:06
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(name = "passport")
@Veto
public class Passport implements Serializable{

    private Long passportId;
    private String serial;
    private String number;
    private String whoIssued;
    private Date whenIssued;
    private Debtor debtor;

    private Date dateStart;
    private Date dateEnd;

    @Id
    @Column(name = "passport_id")
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getPassportId() {
        return passportId;
    }

    public void setPassportId(Long passportId) {
        this.passportId = passportId;
    }

    public String getSerial() {
        return serial;
    }

    public void setSerial(String serial) {
        this.serial = serial;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public String getWhoIssued() {
        return whoIssued;
    }

    public void setWhoIssued(String whoIssued) {
        this.whoIssued = whoIssued;
    }

    public Date getWhenIssued() {
        return whenIssued;
    }

    public void setWhenIssued(Date whenIssued) {
        this.whenIssued = whenIssued;
    }

    public Date getDateStart() {
        return dateStart;
    }

    public void setDateStart(Date dateStart) {
        this.dateStart = dateStart;
    }

    public Date getDateEnd() {
        return dateEnd;
    }

    public void setDateEnd(Date dateEnd) {
        this.dateEnd = dateEnd;
    }

    @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
    @JoinColumn(name = "debtor_id")
    public Debtor getDebtor() {
        return debtor;
    }

    public void setDebtor(Debtor debtor) {
        this.debtor = debtor;
    }


}
